package com.wskj.controller.common;

import com.wskj.common.core.controller.BaseController;
import com.wskj.common.core.domain.AjaxResult;
import com.wskj.system.service.ISysConfigService;
import com.wskj.workbench.vo.app.AppSysConfigVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 系统参数表
 */
@Api(tags = "系统参数获取")
@RestController
@RequestMapping("/api/config")
@AllArgsConstructor
public class ApiSysConfigController extends BaseController {

    private final ISysConfigService configService;

    /**
     * 根据参数键名查询参数值
     */
    @ApiOperation("根据key获取系统参数")
    @GetMapping(value = "/config")
    public AjaxResult<AppSysConfigVo> getConfigKey(@ApiParam(value = "参数键值(手续费传with_amount,平台扣除的税点传pingtai_percent,主播身份传zhubo_price,团长身份传 tuanzhang_price,分公司身份传fengongsi_price)", required = true)
                                                   @RequestParam(value = "configKey") String configKey) {
        AppSysConfigVo appSysConfigVo = configService.getAppConfigValue(configKey);
        return AjaxResult.success(appSysConfigVo);
    }

}
